package com.hex.campus.backend.hex_campus_backend.repository;

import com.hex.campus.backend.hex_campus_backend.entity.PartnerMatch;
import org.springframework.data.jpa.repository.JpaRepository;
import com.hex.campus.backend.hex_campus_backend.entity.User;
import com.hex.campus.backend.hex_campus_backend.entity.PartnerMatch;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;

public interface PartnerMatchRepository extends JpaRepository<PartnerMatch, Long> {
    boolean existsByPartnerIdAndMatcherId(Long partnerId, Long matcherId);

    @Query("SELECT pm FROM PartnerMatch pm WHERE pm.matcher.id = :userId OR pm.partner.user.id = :userId")
    List<PartnerMatch> findByUserInvolved(@Param("userId") Long userId);
}